<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content ">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default"
                   data-original-title="返回管理员列表"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 编辑管理员</h3>
                </div>
                <div class="panel-body ">
                    <!--表单数据-->
                    <form method="post" id="adminHandle" action="{:U('Seller/Admin/adminHandle')}">
                        <!--通用信息-->
                        <div class="tab-content col-md-10">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                    <empty name="info">
                                        <tr>
                                            <td class="col-sm-2">前台用户名：</td>
                                            <td class="col-sm-8">
                                                <input type="text" class="form-control" name="user_name"
                                                       value="{$info.user_name}">
                                                <p class="text-warning">请先在前台注册会员账号，这里为前台会员名称</p>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>用户密码：</td>
                                            <td>
                                                <input type="password" class="form-control" name="password"
                                                       value="{$info.password}">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>登陆账号：</td>
                                            <td>
                                                <if condition="$info[seller_id] gt 0">{$info.seller_name}
                                                    <else/>
                                                    <input type="text" class="form-control" name="seller_name"></if>
                                                <p class="text-warning">此账号为商家管理后台登录账号</p>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>是否激活：</td>
                                            <td>
                                                <input type="radio" name="enabled" value="0"
                                                <if condition="$info[enabled] eq 0">checked</if>
                                                > 启用
                                                <input type="radio" name="enabled" value="1"
                                                <if condition="$info[enabled] eq 1">checked</if>
                                                > 停用
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>所属角色：</td>
                                            <td>
                                                <select name="group_id">
                                                    <volist name="role" id="item">
                                                        <option value="{$item.group_id}"
                                                        <if condition="$item[group_id] eq $info[group_id]">
                                                            selected="selected"
                                                        </if>
                                                        >{$item.group_name}</option>
                                                    </volist>
                                                </select>
                                            </td>
                                        </tr>
                                        <else/>
                                        <tr>
                                            <td>原密码：</td>
                                            <td>
                                                <input type="password" class="form-control" name="password">
                                                <p class="text-warning">若忘记原密码请去前台会员中心通过邮箱或手机验证找回密码</p>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>新密码：</td>
                                            <td>
                                                <input type="password" class="form-control" name="password2">
                                            </td>
                                        </tr>
                                    </empty>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td>
                                            <input type="hidden" name="seller_id" value="{$info.seller_id}">
                                        </td>
                                        <td class="text-right"><input class="btn btn-primary" type="button"
                                                                      onclick="adsubmit()" value="保存"></td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </form><!--表单数据-->
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    function adsubmit() {
        if ($('input[name=user_name]').val() == '') {
            layer.msg('用户名不能为空！', {icon: 2, time: 1000});   //alert('少年，用户名不能为空！');
            return false;
        }
        if ($('input[name=email]').val() == '') {
            layer.msg('邮箱不能为空！', {icon: 2, time: 1000});//alert('少年，邮箱不能为空！');
            return false;
        }
        if ($('input[name=password]').val() == '') {
            layer.msg('原密码不能为空！', {icon: 2, time: 1000});//alert('少年，密码不能为空！');
            return false;
        }

        if ($('input[name=password2]').val() == '') {
            layer.msg('新密码不能为空！', {icon: 2, time: 1000});//alert('少年，密码不能为空！');
            return false;
        }
        $('#adminHandle').submit();
    }
</script>
</body>
</html>